home
***
CD-ROM
|
disk
|
FTP
|
other
***
search
/
Cream of the Crop 26
/
Cream of the Crop 26.iso
/
program
/
snip9707.zip
/
STRUPR.C
< prev
next >
Wrap
C/C++ Source or Header
|
1997-07-05
|
1KB
|
64 lines
/* +++Date last modified: 05-Jul-1997 */
/*
** Portable, public domain replacements for strupr() & strlwr() by Bob Stout
*/
#include <ctype.h>
#include "snip_str.h"
#if defined(__cplusplus) && __cplusplus
extern "C" {
#endif
char *strupr(char *string)
{
char *s;
if (string)
{
for (s = string; *s; ++s)
*s = toupper(*s);
}
return string;
}
char *strlwr(char *string)
{
char *s;
if (string)
{
for (s = string; *s; ++s)
*s = tolower(*s);
}
return string;
}
#if defined(__cplusplus) && __cplusplus
}
#endif
#ifdef TEST
#include <stdio.h>
#include <stdlib.h>
main(int argc, char *argv[])
{
if (argc < 2)
{
puts("Usage: STRUPR string1 [...string2 [...stringN]]");
return EXIT_FAILURE;
}
while (--argc)
{
printf("Original = \"%s\"\n", *++argv);
printf("strupr() = \"%s\"\n", strupr(*argv));
printf("strlwr() = \"%s\"\n", strlwr(*argv));
}
return EXIT_SUCCESS;
}
#endif /* TEST */